#include "stdafx.h"
#include "CppUnitTest.h"
#include "DicomAttribute.h"
#include "DicomAttributeGroup.h"

#include <string>
#include <vector>

using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace std;

namespace UnitTests
{		
   TEST_CLASS(DicomAttributeTests)
   {
   public:
      
      TEST_METHOD(DicomAttributeTakesValues)
      {
         // given
         wstring tag{ L"Tag" };
         wstring name{ L"Name" };

         // when
         DicomAttribute sut{ tag, name };
         tag = L"Modified";
         name = L"Modified";

         // then
         Assert::AreEqual(L"Tag", sut.Tag.c_str());
         Assert::AreEqual(L"Name", sut.Name.c_str());
      }

      TEST_METHOD(DicomAttributeGroupTakesValues)
      {
         // given
         wstring name{ L"Name" };
         vector<DicomAttribute> items;
         items.push_back(DicomAttribute{ L"Tag1", L"Name1" });
         items.push_back(DicomAttribute{ L"Tag2", L"Name2" });
         items.push_back(DicomAttribute{ L"Tag3", L"Name3" });
                                                            
         // when
         DicomAttributeGroup sut{ name, items };
         name = L"Modified";
         items.clear();

         // then
         Assert::AreEqual(L"Name", sut.Name.c_str());
         Assert::AreEqual(0, (int)items.size());
         Assert::AreEqual(3, (int)sut.Items.size());
      }
   };
}